In flash memories, in order to raise the frequency of appearance of a memory cell of which a threshold voltage distribution after writing is an erased state, the frequency of appearance of “1” between “1” and “0” included in a write data string is increased.